import { Route, withRouter } from "react-router-dom"
import React from "react"

//一个页面组件

const Other = (props) => {
    console.log(props)
    return (
        <fieldset>
            <legend>其它组件</legend>
            <h1>其它组件</h1>
        </fieldset>
    )
}

class Base extends React.Component {
    handleClick = () => {
        // console.log(this.props)
        //react路由中 参数可以随便的传递
        //跳转路径的key pathname不能乱写
        this.props.history.push({ pathname: '/other', query: { id: 999 }, abc: { a: 777 } })
    }
    render() {
        return (
            <fieldset>
                <legend>jsx版本</legend>
                <button onClick={this.handleClick}>一个朴实无华的按钮</button>
                <Route path="/other" component={Other} />
            </fieldset>
        )
    }
}

export default withRouter(Base)